#include<bits/stdc++.h>
using namespace std;
int n,t,k,x, w[100005],ans;
struct P{
	int x;
	int t;
}p;
queue<P>ships;
int main(){
    cin >> n;
    for(int i = 1;i <= n ;i ++) {
        cin >> t >> k;
        while (!ships.empty()){
            p = ships.front();
            if (p.t + 86400 <=t){
                w[p.x] --;
                if (!w[p.x]) ans --;
                ships. pop();
            }
            else
                break;
        }
        for(int j = 1;j <= k;j ++ ) {
            cin >>x;
            p.x =x;
            p.t = t;
            ships.push(p );
            if(!w[x]) ans++ ;
            w[x]  ++;
        }
        cout << ans<< "\n" ;
    }
    return  0 ;
}
